package com.example.testdemo.noticeBar;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;

import com.example.testdemo.R;

/**
 * Created by MrYan on 2018/9/14.
 */

public class NoticeToast {

    private Context context;
    private Toast toast;

    public NoticeToast(Context context){
        this.context = context;
    }

    public void initToast(){
        toast = new Toast(context);
        toast.setGravity(Gravity.TOP,0,0);
        View view = LayoutInflater.from(context).inflate(R.layout.view_bar,null);
        toast.setView(view);
    }

    public void show(){
        initToast();
        toast.show();
    }

}
